/* rcsoisla.i -Logistics Accounting- Internal Procedures for Shipper Confirm  */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.2 $                                                       */
/*V8:ConvertMode=NoConvert                                                    */
/* $Revision: 1.2 $    BY: Samir Bavkar   DATE: 08/15/02 ECO: *P09K*        */

/******************************************************************************/
/* USED IN SHIPPER CONFIRM (RCSOIS1.P) AND AUTO SHIPPER CONFIRM (RCAUIS01.P) */

Procedure changeShipperNumberInLogAcctDetail:
/*--------------------------------------------------------------------
   Purpose:     Create lacd_det for shipper from lacd_det record for
                pre-shipper and delete the lacd_det record for pre-shipper.
   Parameters:
   Notes:
----------------------------------------------------------------------*/
define input parameter  ip_from_ref_type     as character no-undo.
define input parameter  ip_from_ref          as character no-undo.
define input parameter  ip_from_shipfrom     as character no-undo.
define input parameter  ip_to_ref_type       as character no-undo.
define input parameter  ip_to_ref            as character no-undo.
define input parameter  ip_to_shipfrom       as character no-undo.


define variable l_NoRecordsFound as logical no-undo.

   /* CREATE SHIPPER LACD_DET RECORD FROM PRE-SHIPPER RECORD */
   {gprunmo.i  &module = "LA" &program = "lacplacd.p"
               &param  = """(input ip_from_ref_type,
                             input ip_from_ref,
                             input ip_from_shipfrom,
                             input ip_to_ref_type,
                             input ip_to_ref,
                             input ip_to_shipfrom,
                             output l_NoRecordsFound)"""}

   /* DELETE LACD_DET RECORD FOR PRE-SHIPPER */
   if not l_NoRecordsFound then do:
      /* DELETE LOGISTICS ACCTG CHARGE DETAIL IF IT EXISTS */
      {gprunmo.i  &module = "LA" &program = "laosupp.p"
                  &param  = """(input 'DELETE',
                                input ip_from_ref_type,
                                input ip_from_ref,
                                input ip_from_shipfrom,
                                input ' ',
                                input ' ',
                                input no,
                                input no)"""}
   end.

end procedure. /* changeShipperNumberInLogAcctDetail */

Procedure validateSOForLogisticsAccounting:

   /*  PARAMETER        INPUT/OUTPUT    DESCRIPTION        */
   /*  ---------        ------------    -----------        */
   /*  p_so1            Input           First SO number    */
   /*  p_so2            Input           Second SO number   */
   /*  p_msg_text       Output          Message for        */
   /*                                   violated           */
   /*                                   consolidation rule */


   define input  parameter p_so1     like so_nbr     no-undo.
   define input  parameter p_so2     like so_nbr     no-undo.
   define output parameter p_msg_text as character   no-undo.

   define buffer so_buff1 for so_mstr.
   define buffer so_buff2 for so_mstr.
   define buffer si_buff1 for si_mstr.
   define buffer si_buff2 for si_mstr.

   for first so_buff1 where so_buff1.so_nbr = p_so1 no-lock:
   end.
   for first so_buff2 where so_buff2.so_nbr = p_so2 no-lock:
   end.

   for first si_buff1 where si_buff1.si_site = so_buff1.so_site no-lock:
   end.

   for first si_buff2 where si_buff2.si_site = so_buff2.so_site no-lock:
   end.


   if so_buff1.so_curr     <> so_buff2.so_curr then
      p_msg_text = getTermLabel("CURRENCY",20).

   if so_buff1.so_fix_rate  <> so_buff2.so_fix_rate then
      p_msg_text = getTermLabel("FIX_RATE",20).

   if so_buff1.so_fr_terms  <> so_buff2.so_fr_terms then
      p_msg_text = getTermLabel("FREIGHT_TERMS",20).

   if so_buff1.so_fix_rate = yes and so_buff2.so_fix_rate = yes
      and (so_buff1.so_ex_rate  <> so_buff2.so_ex_rate or
      so_buff1.so_ex_rate2 <> so_buff2.so_ex_rate2) then
      p_msg_text = getTermLabel("EXCHANGE_RATE",25).

   if ((available si_buff1 and available si_buff2
      and si_buff2.si_entity <> si_buff1.si_entity)
      or  (not available si_buff2
      and available si_buff1
      and si_buff1.si_entity <> "" )) then
      p_msg_text = getTermLabel("ENTITY",20).

end procedure. /* validateSOForLogisticsAccounting */
